<template>
    <div class="requirement-main">
        <div class="requirement-top">
            <div class="requirement-top-main">
                <div class="main-search">
                    <el-input 
                        v-model="search" 
                        placeholder="请输入内容"></el-input>
                    <el-button 
                        type="info" 
                        plain 
                        @click="this.getList()">
                            搜索
                    </el-button>
                </div>
                <el-button 
                    type="success" 
                    plain 
                    @click="dialogVisible = true"
                    class="add">
                        添加
                </el-button>
            </div>
        </div>
        <div class="requirement-context">
            <el-table
                    :data="items"
                    style="width: 100%"
                    stripe="true">
                    <el-table-column
                        prop="title"
                        label="标题"
                        width="180">
                    </el-table-column>
                    <el-table-column
                        prop="sku"
                        label="类型"
                        width="180">
                    </el-table-column>
                    <el-table-column
                        prop="person"
                        label="人数"
                        width="180">
                    </el-table-column>
                    <el-table-column
                        prop="create_time"
                        label="创建时间"
                        width="180">
                    </el-table-column>
                    <el-table-column
                        prop="term_day"
                        label="截止时间"
                        width="180">
                    </el-table-column>
                    <el-table-column label="操作">
                        <el-button
                            size="mini"
                            @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                        <el-button
                            size="mini"
                            type="danger"
                            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                    </el-table-column>
                </el-table>
        </div>
    </div>
</template>

<script>
import request from '@/utils/request.js';
import axios from 'axios';
import setHeader from '@/api/tools/setHeaders.js'

export default {
    data(){
        return{
            items:[]
        }
    },
    methods:{
        getList(){
            let headers = setHeader();
            request.post("/api/system/projectList",this.search,{headers:headers}).then(res=>{
                this.items = res.data
                console.log(res)
            })
        }
    },
    mounted() {
        this.getList();
    },
}
</script>

<style lang="scss" scoped>
.requirement-main{
    background-color: white;
    width: 1600px;
    min-height: 400px;
    margin-left: 20px;
    .requirement-top{
        height: 80px;
        border-bottom: 1px solid rgb(197, 197, 197);
        .requirement-top-main{
            display: flex;
            align-items: center;
            height: 100%;
            .main-search{
                width: 400px;
                display: flex;
                padding-left: 20px;
            }
        }
        .add{
            margin-left: 20px;
            width: 100px
        }
    }
}
</style>